<template>
  <div class="app-container">
    <el-row>
      <el-col :span="4" class="tl-left-tree">
        <el-input v-model="queryTreeParam.qry_name" placeholder="请输入页面名称" @keyup.enter.native="filterTree" ref="treeSearch">
          <el-button current-node-key="" slot="append" icon="el-icon-search" @click="filterTree"></el-button>
        </el-input>
        <el-scrollbar ref="treeScroll" :style="{ height: treeHeight + 'px' }" resizable-key="treeHeight" :resizable-reduce="20" :resizable-refs="['treeSearch']">
          <el-tree class="tl-tree" ref="tree" :data="treeData" node-key="id" :default-expand-all="true" :expand-on-click-node="false" highlight-current @node-click="doTreeQuery" :filter-node-method="filterTreeNode"> </el-tree>
        </el-scrollbar>
      </el-col>
      <el-col :span="20">
        <el-row>
          <!-- 查询 -->
          <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false">
            <template slot="search">
              <el-form-item label="页面名称">
                <el-input v-model="queryParam.qry_name" placeholder></el-input>
              </el-form-item>
              <el-form-item label="页面编码">
                <el-input v-model="queryParam.qry_code" placeholder></el-input>
              </el-form-item>
            </template>
          </tl-list-search>
          <!-- 工具栏 -->
          <tl-list-toolbar ref="toolbar" @refresh="doRefresh" @columnCustomize="doColumnCustomize" :isDisplayAdd="true" :isDisplayDeleteBatch="false" :isDisplayExport="false" @add="openAddDialog('editForm')"></tl-list-toolbar>
          <el-table class="tl-table" ref="mainTable" style="width:100%" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" row-key="id" border fit :row-class-name="doChangeRowClassName">
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column type="index" label="序号" width="55px" header-align="center" align="center"> </el-table-column>
            <el-table-column prop="name" label="页面名称" min-width="16.5%" sortable="custom" sort-by="name" align="center"></el-table-column>
            <el-table-column prop="code" label="页面编码" min-width="13.5%" sortable="custom" sort-by="code" align="center"></el-table-column>
            <el-table-column prop="relationdata" label="关联的数据" min-width="13.5%" sortable="custom" sort-by="code" align="center"></el-table-column>
            <el-table-column prop="extendfield1" label="扩展1" min-width="13.5%" sortable="custom" sort-by="extendfield1" align="center"></el-table-column>
            <!-- <el-table-column prop="dispcatalog3" label="产品类别3" min-width="12%" sortable="custom" sort-by="catalog3"></el-table-column> -->
            <el-table-column prop="extendfield2" label="扩展2" min-width="13.5%" sortable="custom" sort-by="extendfield2" align="center"></el-table-column>
            <el-table-column prop="extendfield3" label="扩展3" min-width="16.5%" sortable="custom" sort-by="extendfield3" align="center"></el-table-column>
            <el-table-column prop="extendfield4" label="扩展4" min-width="16.5%" sortable="custom" sort-by="extendfield3" align="center"></el-table-column>
            <el-table-column prop="dispenabled" label="有效" min-width="9.5%" sortable="custom" sort-by="enabled" align="center"></el-table-column>
            <el-table-column prop="description" label="备注" min-width="9.5%" sortable="custom" sort-by="description" align="center"></el-table-column>
            <el-table-column label="操作" min-width="13.5%" align="center" fixed="right">
              <template slot-scope="scope">
                <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)">编辑</el-button>
                <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)">删除</el-button>
                <el-button type="text" icon="el-icon-view" @click="openViewDialog('editForm', scope.row.id)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 列表分页 -->
          <el-row class="pagebar" ref="pager">
            <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"></el-pagination>
          </el-row>
          <tl-edit ref="editForm" @refresh="doRefresh" :pageid="this.selectTreeNode.id" :catalog1List="catalog1List" :catalog2List="catalog2List" :catalog3List="catalog3List" :product_lineList="product_lineList" :enabledList="enabledList"></tl-edit>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>
<script>
// import checkPermission from '@/utils/permission' // 权限判断函数
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
import { mixin_tree_list } from '@tapui/mixins/mixin_tree_list'
/** 子组件 */
import tlEdit from './edit'
import { getAction, putAction, postAction } from '@tapui/utils/http'
export default {
  name: 'pageTabMgt',
  components: { tlEdit },
  mixins: [mixin_list, mixin_tree_list],
  data() {
    return {
      description: '这是产品管理页面',
      urlPrefix: '/app/appPageTab/',
      url: {
        queryTree: '/app/appPage/queryTreeList',
        queryCodeList: '/app/appPageTab/dataCodeList'
      },
      catalog1List: [],
      catalog2List: [],
      catalog3List: [],
      product_lineList: [],
      enabledList: []
    }
  },
  methods: {
    showViewD() {
      alert(this.selectTreeNode.id)
    },
    assignDefaultValue() {
      // this.$refs.editForm.model.pageid = this.selectTreeNode.id
    }
  },
  mounted() {
    // this.queryDataCodeList({})
  }
}
</script>
